using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Entities;
using Utility;

namespace BUS
{
   public class tbTaikhoanBUS
    {
        public static void Insert(tbTaikhoan tk)
        {
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            tkDAL.Insert(tk);
        }
        public static void Update(tbTaikhoan tk)
        {
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            tkDAL.Update(tk);
        }
        public static void Delete(int iD)
        {
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            tkDAL.Delete(iD);
        }
        public static tbTaikhoanCollection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            return tkDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbTaikhoanCollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            return tkDAL.Get(cri.Criter, 0, 0, tbTaikhoanCollumn.mataik .ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbTaikhoan GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, tbTaikhoanCollumn.mataik .ToString(), Condition.EQUAL, iD);
            tbTaikhoanDAL tkDAL = new tbTaikhoanDAL();
            tbTaikhoanCollection tkColl = tkDAL.Get(cri.Criter, 0, 0, tbTaikhoanCollumn.mataik .ToString(), OrderDirection.ASC.ToString(), out total);
            if (tkColl.Count > 0)
                return tkColl[0];
            return null;
        }
    }
}
